package cards.dao;

import cards.entity.AttendedCardActivity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface AttendedCardActivityDao {
    String TABLE_NAME = "attended_card_activity";
    String INSERT_FIELDS = "title, username, card1, card2, card3, card4, card5, available_scratch_times";
    String SELECT_FIELDS = "id, title, username, card1, card2, card3, card4, card5, available_scratch_times";

    int addAttendedCardActivity(AttendedCardActivity attendedCardActivity);

    Long countAttendedCardActivityByUsername(@Param("username") String username);
    List<AttendedCardActivity> findAll();
    AttendedCardActivity findAttendedCardActivityById(@Param("id") Long id);
    List<AttendedCardActivity> findAttendedCardActivityByTitle(@Param("title") String title);//laobug
    List<AttendedCardActivity> findAttendedCardActivityByUsernameOrderedById(@Param("username") String username);

    AttendedCardActivity findAttendedCardActivityByTitleAndUsername(@Param("title") String title, @Param("username") String username);
    int updateCard1ById(@Param("id") Long id, @Param("card1") Date card1);
    int updateCard2ById(@Param("id") Long id, @Param("card2") Date card2);
    int updateCard3ById(@Param("id") Long id, @Param("card3") Date card3);
    int updateCard4ById(@Param("id") Long id, @Param("card4") Date card4);
    int updateCard5ById(@Param("id") Long id, @Param("card5") Date card5);
    int updateAvailableScratchTimes(@Param("id") Long id, @Param("available_scratch_times") Long available_scratch_times);

}
